<?php
/**
 * Created by PhpStorm.
 * User: sosyuki
 * Date: 2018/5/24
 * Time: 17:16
 */

namespace Drupal\distribution\ViewsController\handler\field;


use views_handler_field_date;

class DistributionFieldValidity extends views_handler_field_date {

  public function get_value($values, $field = NULL) {
    $value = parent::get_value($values, $field);
    $use = variable_get_value('distribution_validity_use');
    switch ($use) {
      case 'all':
        {
          return $value;
          break;
        }
      case 'seconds':
        {
          $number = variable_get_value('distribution_validity_seconds');
          return $value + $number;
          break;
        }
    }
    return $value;
  }

  public function render($values) {
    $display = parent::render($values);
    $use = variable_get_value('distribution_validity_use');
    switch ($use) {
      case 'all':
        {
          return '永久';
          break;
        }
    }
    return $display;
  }


}
